<?php

namespace App\Http\Requests\Api;



use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;

class ActivityRequest extends FormRequest
{
    public function rules()
    {

        return [
            'title' => ['required', 'unique:activity,title'],
            'price' => 'required',
            'person' => 'required',
            'address' => 'required',
            'start_time' => 'required|date',
            'end_time' => 'required|date',
            'join_time' => 'required|date',
            'content' => 'required',
            'process' => 'required',
           ];
    }

    public function messages()
    {
        return [
            'title.required'=>'标题必须填写',
            'title.unique' => '标题已经存在',
            'price.required' => '价格不能为空',
            'person.required' => '参加人数不能为空',
            'address.required' => '活动地址不能为空',
            'start_time.required' => '活动开始时间不能为空',
            'start_time.date' => '活动开始时间必须是日期格式',
            'end_time.required' => '活动结束时间不能为空',
            'join_time.required' => '报名开始时间不能为空',
            'content.required' => '活动内容不能为空',
            'process.required' => '活动流程不能为空',

        ];
    }


}
